package com.runmi.webchat.aftersale.web.api.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.runmi.webchat.aftersale.common.result.Result;
import com.runmi.webchat.aftersale.common.result.ResultFactory;
import com.runmi.webchat.aftersale.dbcore.entity.RegionInfo;
import com.runmi.webchat.aftersale.dbcore.mapper.RegionInfoMapper;

@Service
public class ApiRegionService {
	
   @Autowired
   private RegionInfoMapper regionInfoMapper;

   
	 public Result queryRegionsByParentId(Integer parentRegionId) {
		 Result result = ResultFactory.getResultFail();
		 try {
		     RegionInfo scmRegionInfo = new RegionInfo();
		     scmRegionInfo.setParentId(parentRegionId);
		     List<RegionInfo> scmRegionInfoList = regionInfoMapper.select(scmRegionInfo);
		     result = ResultFactory.getResultSuccess(scmRegionInfoList);
		 } catch (Exception e) {
		    e.printStackTrace();
		 }
		 return result;
	}

}
